package com.example.smarthome;

public class SmartCurtain extends SmartDevice {
    private int openPercentage;

    public SmartCurtain(String id, String name) {
        super(id, name);
        this.openPercentage = 0;
    }

    public void setOpenPercentage(int percent) {
        if (percent < 0 || percent > 100) {
            System.out.println("打开百分比无效！");
            return;
        }
        this.openPercentage = percent;
        System.out.println(deviceName + " 打开至 " + openPercentage + "%");
    }

    @Override
    public String getDeviceType() {
        return "智能窗帘";
    }
}